import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'

// 引入icons图标
import '@/icons'
import '@/assets/icon/iconfont.css' // custom icon css
// 引入axios
import axios from 'axios'
import { VueJsonp } from 'vue-jsonp'
// 引入element-ui当中的所有组件
import ElementUI from 'element-ui'
// 引入element-ui的所有样式
import 'element-ui/lib/theme-chalk/index.css'
// 全局css
import '@/styles/index.scss'
// 初始化
import 'normalize.css/normalize.css'
// 路由拦截
import '@/permission'
// 国际汉化
import i18n from './lang/index'
// 时间
import moment from 'moment'
// ag-grid
import 'ag-grid-enterprise'
import LyDialog from './components/LyDialog/index.vue'
import LyButton from './components/LyButton/index.vue'
import LyForm from '@/components/LyForm/index.vue'
import ClientTable from './components/Table/ClientTable/ClientTable.vue'
import ServerTable from './components/Table/ServerTable/ServerTable.vue'

Vue.component('LyButton', LyButton)
Vue.component('LyDialog', LyDialog)
Vue.component('LyForm', LyForm)
Vue.component('ClientTable', ClientTable)
Vue.component('ServerTable', ServerTable)

const { mockXHR } = require('../mock')
mockXHR()

// moment
Object.defineProperty(Vue.prototype, '$moment', {
  value: moment
})
// ElementUI
Vue.use(ElementUI, {
  size: 'mini',
  i18n: (key, value) => i18n.t(key, value)
})
Vue.use(VueJsonp)

Vue.config.productionTip = false
Vue.prototype.$http = axios
Vue.prototype.$bus = new Vue()

new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
